Skip to content

Fix: keep dispatch marker in producer slot state - #1411

Merged
ChaoWao merged 2 commits into
hw-native-sys:mainfrom
ChaoWao:fix/early-dispatch-marker-locality
Jul 20, 2026
Merged

Fix: keep dispatch marker in producer slot state#1411
ChaoWao merged 2 commits into
hw-native-sys:mainfrom
ChaoWao:fix/early-dispatch-marker-locality

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Move the producer dispatch-propagated once-guard into an unused ready_state bit in the already-hot 64-byte slot state.
  • Preserve late-wiring exactly-once seeding while skipping early-only marker checks after a fanin is disqualified.
  • Rename the completed-predecessor count and cover lifecycle flag preservation and slot-reuse reset in unit tests.

Related Issues

Move the propagation once-guard into an unused ready-state bit so late fanin wiring stays on the producer slot cache line. Keep completed fanin accounting for normal readiness while skipping early-only marker checks after disqualification.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 740462ef-2c30-4d5c-8cb2-88e185384093

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Dispatch propagation tracking moves from PTO2TaskPayload to a task-slot ready_state bit. Fanin wiring now uses completed_fanin, scheduler propagation uses slot helpers, documentation reflects the updated synchronization, and wiring tests cover marker lifecycle and propagation states.

Changes

Dispatch propagation and fanin wiring

Layer / File(s) Summary
Slot-level propagation marker contract
src/a2a3/runtime/tensormap_and_ringbuffer/runtime/pto_runtime2_types.h
Dispatch propagation is represented by an atomic ready_state flag with accessor and claim helpers; payload initialization and slot reuse behavior are updated.
Fanin accounting and propagation integration
src/a2a3/runtime/tensormap_and_ringbuffer/runtime/pto_orchestrator.cpp, src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/pto_scheduler.h, src/a2a3/runtime/tensormap_and_ringbuffer/docs/RUNTIME_LOGIC.md
Fanin wiring counts completed producers, uses slot-level propagation state, updates early-dispatch seeding, and documents the revised locking and release accounting.
Wiring and marker validation
tests/ut/cpp/a2a3/test_wiring.cpp
Tests cover marker claiming and reset behavior, completed-fanin accounting, and propagation across launch, doorbell, publication, and rendezvous states.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FaninWiring
  participant TaskSlotState
  participant DispatchPropagation
  FaninWiring->>TaskSlotState: Check propagation marker
  FaninWiring->>FaninWiring: Count completed_fanin and seed early dispatch
  DispatchPropagation->>TaskSlotState: Atomically claim marker
  DispatchPropagation->>FaninWiring: Propagate fanin
Loading

Possibly related PRs

Poem

A bunny hops where fanins meet,
With ready bits both clear and neat.
Old payload flags now fade from sight,
Slots guard propagation day and night.
Completed counts make wiring flow—
And tests confirm the carrots grow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving the dispatch marker into producer slot state.
Description check ✅ Passed The description matches the patch by describing the slot-state marker move, fanin accounting rename, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the task dispatch propagation logic by moving the dispatch_propagated flag from the shared PTO2TaskPayload structure to the slot-local ready_state bitmask in PTO2TaskSlotState to optimize cache line usage. It also renames early_finished to completed_fanin for clarity. The reviewer recommends restoring conservative memory ordering (acquire and acq_rel) instead of relaxed for the new has_dispatch_propagated and try_mark_dispatch_propagated methods to ensure robust synchronization for these claim guards.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

- Restore conservative acquire/acq_rel ordering for marker operations.
- Align the A5 completed-fanin name with A2A3 in code, docs, and tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant